package com.popcorn.notice.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.popcorn.action.Action;
import com.popcorn.action.ActionForward;
import com.popcorn.notice.dao.NoticeDAO;
import com.popcorn.notice.model.NoticeModel;

public class NoticeUpdateViewAction implements Action {

	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) throws Exception {

		NoticeDAO noticeDAO = new NoticeDAO();
		
		int idx = Integer.parseInt(request.getParameter("idx"));
		
		NoticeModel noticeModel = noticeDAO.modelDetail(idx);
		request.setAttribute("model", noticeModel);
		
		ActionForward forward= new ActionForward();
	   	forward.setRedirect(false);
   		forward.setPath("NoticeUpdate.jsp");
   		return forward;
	}

}
